package com.lagou.sqlsession;

import com.lagou.pojo.Configuration;

import java.sql.SQLException;

public class DefaultSqlSessionFactory implements SqlSessionFactory{

    private Configuration configuration;

    public  DefaultSqlSessionFactory(Configuration configuration){
        this.configuration=configuration;
    }


    public SqlSession openSession() throws SQLException {
        Executor executor =new SimpleExecutor(configuration);
        DefaultSqlSession defaultSqlSession = new DefaultSqlSession(configuration, executor);
        return defaultSqlSession;
    }
}
